package com.jingzhongbao.springboot.dao;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.jingzhongbao.springboot.domain.User;

public interface UserRepository extends JpaRepository<User, String> {
	/**
     * 根据用户名查找用户
     * @param username
     * @return
     */
	User findByUsername(String username);
	@Modifying
	@Transactional
	@Query("update User u set u.username = ?1 where u.id = ?2")
	int modifyByIdAndUserId(String  username, String id);
}
